Tree delete and watch status


In [1]:
%matplotlib inline

import os
import StringIO
import time
import numpy
import pandas
import seaborn
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from qumulo.rest_client import RestClient

In [2]:
rc = RestClient("<qumulo-cluster>", 8000)
rc.login("<qumulo-user>", "<qumulo-password>");

In [23]:
parent_path = "/test"
dir_name = "test1"
file_count = 10000

print("This test takes ~1 minute to run.")
full_dir_path = parent_path + "/" + dir_name

rc.fs.create_directory(name="test1", dir_path="/test")
start_time = time.time()
for file_num in range(file_count):
    rc.fs.create_file("f%s.txt" % file_num, dir_path = full_dir_path)
print("Created %s files in %s seconds" % (file_count, int(time.time() - start_time)))
rc.fs.delete_tree(full_dir_path)
last_rem = file_count
while last_rem > 0:
    try:
        d = rc.fs.tree_delete_status(full_dir_path)
        cur_rem = int(d['remaining_files'])
        print("Files remaining: %5s  -  deletes / second: %4s" % (cur_rem, last_rem - cur_rem))
        last_rem = cur_rem
    except:
        break
    time.sleep(1)
print("Done!")


This test takes ~1 minute to run.
Created 10000 files in 46 seconds
Files remaining:  9990  -  deletes / second:   10
Files remaining:  9028  -  deletes / second:  962
Files remaining:  8081  -  deletes / second:  947
Files remaining:  7139  -  deletes / second:  942
Files remaining:  6140  -  deletes / second:  999
Files remaining:  5141  -  deletes / second:  999
Files remaining:  4216  -  deletes / second:  925
Files remaining:  3287  -  deletes / second:  929
Files remaining:  2323  -  deletes / second:  964
Files remaining:  1364  -  deletes / second:  959
Files remaining:   383  -  deletes / second:  981
Done!

In [ ]: